﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Module.SystemUI.Presenter;
using QLBH.StandardUI;
using System.Threading;

namespace Module.SystemUI
{
    public partial class frmUserManagement : Form
    {
        public frmUserManagement()
        {
            InitializeComponent();

            btnEdit.Enabled = false;
            btnDelete.Enabled = false;
        }

        private void frmUserManagement_Load(object sender, EventArgs e)
        {
            try
            {
                LoadDSUser();
            }
            catch (System.Exception ex)
            {
                ShowMessage.Instance.ShowError(ex.Message);
                this.Close();
            }
            
        }
        private void LoadDSUser()
        {
            try
            {
                var users = UserManagementPresenter.Instance.GetDSUsers();

                dataGridView1.DataSource = users;

                dataGridView1.Columns["NhanVienID"].Visible = false;
                dataGridView1.Columns["TenNV"].HeaderText = "Tên nhân viên";
                dataGridView1.Columns["UserName"].HeaderText = "Tên đăng nhập";
                dataGridView1.Columns["NgaySinh"].HeaderText = "Ngày sinh";
                dataGridView1.Columns["Password"].Visible = false;
                dataGridView1.Columns["NgaySinh"].DefaultCellStyle.Format =
                   Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
            }
            catch (System.Exception ex)
            {                                              
                 throw ex;
            }
            
        }
    }
}
